import request from '/@/utils/request';

/**
 * 售后商品
 * @param params 要传的参数值
 * @returns 返回接口数据
 * 售后商品pi接口集合
 */
export function useServiceApi() {
	return {
		getAfterSaleGoodsCount: () => {
			return request({
				url: '/product/after-sale-prod/admin/count',
				method: 'get',
			});
		},
		getAfterSaleGoodsList: (data) => {
			return request({
				url: '/product/after-sale-prod/admin/list',
				method: 'post',
				data,
			});
		},
		addAfterSaleGoods: (data) => {
			return request({
				url: '/product/after-sale-prod/admin/add',
				method: 'post',
				data,
			});
		},
		getAfterSaleGoodsDetail: (id) => {
			return request({
				url: `/product/after-sale-prod/admin/details/${id}`,
				method: 'get',
			});
		},
		updateAfterSaleGoods: (data) => {
			return request({
				url: '/product/after-sale-prod/admin/update',
				method: 'post',
				data,
			});
		},
		publishAfterSaleGoods: (data) => {
			return request({
				url: '/product/after-sale-prod/admin/publish',
				method: 'post',
				data,
			});
		},
		delAfterSaleGoods: (data) => {
			return request({
				url: '/product/after-sale-prod/admin/delete',
				method: 'post',
				data,
			});
		},
		afterSaleGoodsExport: (data) => {
			return request({
				url: '/product/after-sale-prod/admin/excel/out',
				method: 'post',
				responseType: 'arraybuffer',
				data,
			});
		},
	};
}
